package com.vanke.vms.management.dao.daoImpl;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.vanke.vms.common.domain.User;
import com.vanke.vms.management.dao.RegisterDao;

public class RegisterDaoImpl extends HibernateDaoSupport implements RegisterDao {

	@Override
	public void registeUser(User user) {
		getHibernateTemplate().persist(user);
	}

	@Override
	public boolean isDublipcated(String username) {
		if (getHibernateTemplate().find(
				"from User as u Where u.username = " + "'" + username + "'")
				.size() != 0)
			return true;
		return false;

	}

	@Override
	public void updateUser(User user) {
		getHibernateTemplate().update(user);
	}
}
